<!DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html class="js gecko firefox3  win" xml:lang="en" xmlns="http://www.w3.org/1999/xhtml" lang="en"><head>



<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7">  
  <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta name="description" content="Java Code Examples from The Java Developers Almanac">
<meta name="keywords" content="Java,examples">
<meta name="owner" content="Patrick Chan">
  <title>Sudoku Solver | Example Depot</title>  
  <link type="text/css" rel="stylesheet" media="all" href="sudoku_solver_SudokuSolver_dosyalar/views.css">
<link type="text/css" rel="stylesheet" media="all" href="sudoku_solver_SudokuSolver_dosyalar/css_fcfdc168cda61024973a0d1ae90b2bbc.css">
  <script type="text/javascript" src="sudoku_solver_SudokuSolver_dosyalar/js_9ab7f0952ed3ddc9ca6375ed49d622d6.js"></script>
<script type="text/javascript">
<!--//--><![CDATA[//><!--
jQuery.extend(Drupal.settings, { "basePath": "/" });
//--><!]]>
</script>
  <!--[if IE 6]><link rel="stylesheet" href="/sites/all/themes/artisteer_exd/style.ie6.css" type="text/css" /><![endif]-->  
  <!--[if IE 7]><link rel="stylesheet" href="/sites/all/themes/artisteer_exd/style.ie7.css" type="text/css" media="screen" /><![endif]-->
  <script type="text/javascript">if (Drupal.jsEnabled) {$(document).ready(function(){
				window.setTimeout("artNoStyleAdding(document)", 2000);});}</script>
  <script type="text/javascript"> </script>
</head><body>
<div id="art-main">
<div class="art-Sheet">
    <div class="art-Sheet-tl"></div>
    <div class="art-Sheet-tr"></div>
    <div class="art-Sheet-bl"></div>
    <div class="art-Sheet-br"></div>
    <div class="art-Sheet-tc"></div>
    <div class="art-Sheet-bc"></div>
    <div class="art-Sheet-cl"></div>
    <div class="art-Sheet-cr"></div>
    <div class="art-Sheet-cc"></div>
    <div class="art-Sheet-body">
<div class="art-Header">
    <div class="art-Header-jpeg"></div>
<div class="art-Logo">
    <h1 class="art-Logo-name"><a href="http://www.exampledepot.com/" title="Example Depot">Example Depot</a></h1><div class="art-Logo-text">Useful code samples</div></div>
</div>
<div class="art-nav">
        <div class="l"></div>
    <div class="r"></div>
            <ul class="art-menu">
<li class="leaf first"><a href="http://www.exampledepot.com/" title=""><span class="l"> </span><span class="r"> </span><span class="t">Home</span></a></li><li><span class="art-menu-separator"></span></li>
<li class="leaf"><a href="http://www.exampledepot.com/egs" title=""><span class="l"> </span><span class="r"> </span><span class="t">Java</span></a></li><li><span class="art-menu-separator"></span></li>
<li class="leaf"><a href="http://www.exampledepot.com/contact" title=""><span class="l"> </span><span class="r"> </span><span class="t">Contact</span></a></li><li><span class="art-menu-separator"></span></li>
<li class="leaf last"><a href="http://www.exampledepot.com/blog" title=""><span class="l"> </span><span class="r"> </span><span class="t">Blog</span></a></li>
</ul>
	</div>
<div class="art-contentLayout">
<div class="art-sidebar1"><div class="art-Block clear-block block block-search" id="block-search-0">
    <div class="art-Block-cc"></div>
    <div class="art-Block-body">

	<div class="art-BlockContent content">
	    <div class="art-BlockContent-body">
	
		<form action="/egs/Programs/sudoku_solver_SudokuSolver.html" accept-charset="UTF-8" method="post" id="search-block-form">
<div><div class="form-item" id="edit-search-block-form-1-wrapper">
 <input maxlength="128" name="search_block_form" id="edit-search-block-form-1" size="15" title="Enter the terms you wish to search for." class="form-text" type="text">
</div>
<span class="art-button-wrapper"><span class="l"></span><span class="r"></span><input name="op" id="edit-submit" value="Search" class="form-submit art-button" type="submit"></span><input name="form_build_id" id="form-6b7af062b376ba763aafa05eea8c4911" value="form-6b7af062b376ba763aafa05eea8c4911" type="hidden">
<input name="form_id" id="edit-search-block-form" value="search_block_form" type="hidden">

</div></form>

	    </div>
	</div>
	

    </div>
</div>
<div class="art-Block clear-block block block-adsense_managed" id="block-adsense_managed-0">
    <div class="art-Block-cc"></div>
    <div class="art-Block-body">

	<div class="art-BlockContent content">
	    <div class="art-BlockContent-body">
	
		<div style="text-align: center;"><div class="adsense adsense_managed">
<script type="text/javascript"><!--
google_ad_client = "ca-pub-6001183370374757";
/* 160x600 */
google_ad_slot = "6138857183";
google_ad_width = 160;
google_ad_height = 600;
//-->
</script>
<script type="text/javascript" src="sudoku_solver_SudokuSolver_dosyalar/show_ads.js">
</script><script src="sudoku_solver_SudokuSolver_dosyalar/expansion_embed.js"></script><script src="sudoku_solver_SudokuSolver_dosyalar/test_domain.js"></script><script>google_protectAndRun("ads_core.google_render_ad", google_handleError, google_render_ad);</script><ins style="display: inline-table; border: medium none; height: 600px; margin: 0pt; padding: 0pt; position: relative; visibility: visible; width: 160px;"><ins style="display: block; border: medium none; height: 600px; margin: 0pt; padding: 0pt; position: relative; visibility: visible; width: 160px;"><iframe allowtransparency="true" hspace="0" id="google_ads_frame1" marginheight="0" marginwidth="0" name="google_ads_frame" src="sudoku_solver_SudokuSolver_dosyalar/ads.htm" style="left: 0pt; position: absolute; top: 0pt;" vspace="0" width="160" frameborder="0" height="600" scrolling="no"></iframe></ins></ins>
</div></div>
	    </div>
	</div>
	

    </div>
</div>
</div><div class="art-content">
              
<div class="art-Post">
    <div class="art-Post-body">
<div class="art-Post-inner">
<div class="art-PostContent">
<div class="breadcrumb"><a href="http://www.exampledepot.com/egs">Java</a> » <a href="http://www.exampledepot.com/taxonomy/term/389">Java programs</a></div>
</div>
<div class="cleared"></div>

</div>

    </div>
</div>
<div class="art-Post">
    <div class="art-Post-body">
<div class="art-Post-inner">
<h2 class="art-PostHeader"> <a href="http://www.exampledepot.com/egs/Programs/sudoku_solver_SudokuSolver.html" title="Sudoku Solver">Sudoku Solver</a>
</h2>
<div class="art-PostContent">
<div class="art-article"><!-- google_ad_section_start -->
<div class="exd_ex">
The Sudoku puzzle consists of a <span class="exd_v">grid</span> of 9x9 <span class="exd_v">cells</span>. This
81-cell grid is further subdivided into nine <span class="exd_v">subgrids</span> of 3x3
cells. A few of the cells are filled with a single digit between 1 and
9 (the <span class="exd_v">givens</span>). To solve the puzzle, the empty cells must be
filled in such a way that every 9-cell row, column, and subgrid
contains each of the digits between 1 and 9.

<p> Most published Sudoku puzzles can be solved with deductive
reasoning.  For example, if the digit 9 appears in the first 2 rows
and subgrids, then the digit 9 must appear in the 3rd row in the
top-right subgrid.  If in this subgrid, there is only one empty cell,
then the empty cell must contain 9.

</p><p> This solver does not employ deductive reasoning.  Instead, it
employs a technique called <span class="exd_v">bifurcation</span> which systematically
tries every possible digit in every empty cell until the solution is
achieved. Here's a summary of the algorithm.



</p><div class="exd_code">
<div class="exd_code_head"><a href="">COPY</a></div>
<div class="exd_code_body">1. Find an empty cell
   1a. If there are no more empty cells, the puzzle is solved
2. Fill the empty cell with the lowest possible valid number
   2a. If no valid number exists, backtrack to the previous empty cell
      and try the next higher valid number in that cell
3. Go to step 1
</div></div>
 This program consists of two classes – the 
 <span class="exd_c">SudokuSolver</span> class which is the main class and the
 <span class="exd_c">Grid</span> class for holding the values of a grid while it is being solved.


<div class="exd_code">
<div class="exd_code_head"><a href="">COPY</a></div>
<div class="exd_code_body">/**
 * This program is executed in the following way:
 *    java SudokuSolver &lt;input-file&gt;
 * For details of the input-file format, see the Grid.java class.
 *
 * @author  Patrick Chan
 * @version 1, 12/31/05
 * @see Grid
 */
import java.io.*;
import java.util.*;

public class SudokuSolver {
    public static void main(String[] args) throws Exception {
        // Open the file containing the givens
        File file = new File(args[0]);
        FileReader rd = new FileReader(args[0]);

        // Process each grid in the file
        while (true) {
            Grid grid = Grid.create(rd);
            if (grid == null) {
                // No more grids
                break;
            }

            // Find a solution
            List&lt;Grid&gt; solutions = new ArrayList&lt;Grid&gt;();
            solve(grid, solutions);

            printSolutions(grid, solutions);
        }
    }

    // Recursive routine that implements the bifurcation algorithm
    private static void solve(Grid grid, List&lt;Grid&gt; solutions) {
        // Return if there is already a solution
        if (solutions.size() &gt;= 2) {
            return;
        }

        // Find first empty cell
        int loc = grid.findEmptyCell();

        // If no empty cells are found, a solution is found
        if (loc &lt; 0) {
            solutions.add(grid.clone());
            return;
        }

        // Try each of the 9 digits in this empty cell
        for (int n=1; n&lt;10; n++) {
            if (grid.set(loc, n)) {
                // With this cell set, work on the next cell
                solve(grid, solutions);

                // Clear the cell so that it can be filled with another digit
                grid.clear(loc);
            }
        }
    }

    private static void printSolutions(Grid grid, List&lt;Grid&gt; solutions) {
        // Print the grid with the givens
        System.out.println("Original");
        System.out.println(grid);

        // Print the solution
        if (solutions.size() == 0) {
            System.out.println("Unsolveable");
        } else if (solutions.size() == 1) {
            System.out.println("Solved");
        } else {
            System.out.println("At least two solutions");
        }

        // Print the solution(s)
        for (int i=0; i&lt;solutions.size(); i++) {
            System.out.println(solutions.get(i));
        }
        System.out.println();
        System.out.println();
    }
}
</div></div>
Here is the code for the <span class="exd_c">Grid.java</span>:


<div class="exd_code">
<div class="exd_code_head"><a href="">COPY</a></div>
<div class="exd_code_body">/**
 * @author  Patrick Chan
 * @version 1, 12/31/05
 * @see SudokuSolver
 */
import java.io.*;
import java.util.*;

/**
 * A Grid object holds the currently known values of the Sudoku puzzle.
 * The <span class="exd_v">grid</span> consists of 9x9 <span class="exd_v">cells</span> that hold integer values from 0 to 9.
 * A value of 0 indicates that the cell is empty.
 *
 * Each of the 81 cells has a <span class="exd_v">location</span> which is used to identify a
 * specific cell. There are 81 locations, labelled location 0 to location 80.
 * Cell locations are ordered from left-to-right and top-down.
 * For example, location 0 refers to the top-leftmost cell.
 * Location 8 refers to the top-righttmost cell.
 * Location 71 refers to the bottom-leftmost cell.
 * Location 80 refers to the bottom-rightmost cell.
 *
 * The grid consists of 9 <span class="exd_v">columns</span>, labelled column 0 to column 8.
 * The grid consists of 9 <span class="exd_v">rows</span>, labelled row 0 to row 8.
 *
 * The grid consists of 9 <span class="exd_v">subgrids</span>, labelled subgrid 0 to subgrid 8.
 * Each subgrid contains a subgrid of 3x3 cells.
 * Subgrid 0 contains cells - 0, 1, 2, 9, 10, 11, 18, 19, 20.
 * Subgrid 8 contains cells - 60, 61, 62, 69, 70, 71, 78, 79, 80
 */
public class Grid implements Cloneable {
    // Array that contains values of all 81 cells in the grid.
    int[] cells = new int[81];

    // A set of bit-vectors that represent the known values for each column.
    // Specifically, if column c contains the digits d1 and d2,
    //   colsSet[c] = 2^(d1-1)|2^(d2-1)
    // For example, if column 0 contains the values 1 and 4, colsSet[0] = 9.
    // The information in this variable is redundant with the information
    // in the cells variable. The purpose of this variable is to reduce
    // the cost of determining whether a particular digit can be set in
    // a particular cell.
    int[] colsSet = new int[9];

    // This purpose and behavior of this variable is similar to colsSet.
    int[] rowsSet = new int[9];

    // This purpose and behavior of this variable is similar to colsSet.
    int[] subgridSet = new int[9];

    /**
     * This method returns a grid of givens and empty cells ready to be solved.
     * The cells containing givens have values between 1 and 9.
     * Empty cells have the value 0.
     *
     * Characters are read one at a time from the input stream and placed
     * into the grid in left-to-right and top-down order.
     * - The characters 0 or . indicates an empty cell.
     * - The characters 1 to 9 indicates a given.
     * - The character # is used for comments; subsequent characters are
     *   ignored until a newline is encountered.
     * - All other characters are simply ignored.
     *
     * @param     rd  Reader containing the givens
     * @return    null if there are not enough characters in 'rd' to form a grid.
     */
    public static Grid create(Reader rd) throws Exception {
        Grid grid = new Grid();

        // Read until all 81 cells are filled
        for (int loc=0; loc&lt;grid.cells.length; ) {
            // Read a character
            int ch = rd.read();

            // -1 is returned if the input stream has no more characters
            if (ch &lt; 0) {
                // No more characters so return null
                return null;
            }
            if (ch == '#') {
                // Skip to end-of-line
                while (ch &gt;= 0 &amp;&amp; ch != '\n' &amp;&amp; ch != '\r') {
                    ch = rd.read();
                }
            } else if (ch &gt;= '1' &amp;&amp; ch &lt;= '9') {
                // A given
                grid.set(loc, ch-'0');
                loc++;
            } else if (ch == '.' || ch == '0') {
                // Empty cell
                loc++;
            }
        }
        return grid;
    }

    /*
     * Finds an empty cell.
     * @return the location of an empty cell or -1 if there are no empty cells.
     *         Values must be in the range [-1, 80].
     */
    public int findEmptyCell() {
        for (int i=0; i&lt;cells.length; i++) {
            if (cells[i] == 0) {
                return i;
            }
        }
        return -1;
    }

    /*
     * Sets a number in a cell. This method checks to see if
     *   1. the cell is empty
     *   2. the cell is allowed to contain the specified number. E.g. if
     *      the number is 5 but the row already has a 5, the cell will
     *      not be set and false is returned.
     * @param loc  the location of the target cell.
     *             Values must be in the range [0, 80].
     * @param num  the number to set in the cell.
     *             Values must be in the range [1, 9].
     * @return     true if the set was successful.
     */
    public boolean set(int loc, int num) {
        // Compute row and column
        int r = loc/9;
        int c = loc%9;
        int blockLoc = (r/3)*3+c/3;

        boolean canSet = cells[loc] == 0
            &amp;&amp; (colsSet[c] &amp; (1&lt;&lt;num)) == 0
            &amp;&amp; (rowsSet[r] &amp; (1&lt;&lt;num)) == 0
            &amp;&amp; (subgridSet[blockLoc] &amp; (1&lt;&lt;num)) == 0;
        if (!canSet) {
            return false;
        }

        cells[loc] = num;
        colsSet[c] |= (1&lt;&lt;num);
        rowsSet[r] |= (1&lt;&lt;num);
        subgridSet[blockLoc] |= (1&lt;&lt;num);
        return true;
    }

    /*
     * Removes the number in a cell.
     * @param loc  the location of the target cell.
     *             Values must be in the range [0, 80].
     */
    public void clear(int loc) {
        // Compute row and column
        int r = loc/9;
        int c = loc%9;
        int blockLoc = (r/3)*3+c/3;

        int num = cells[loc];
        cells[loc] = 0;
        colsSet[c] ^= (1&lt;&lt;num);
        rowsSet[r] ^= (1&lt;&lt;num);
        subgridSet[blockLoc] ^= (1&lt;&lt;num);
    }


    /**
     * Returns a copy of this grid. Any modifications to the returned
     * grid will not affect this grid.
     *
     * @return a non-null deep copy of this grid.
     */
    public Grid clone() {
        Grid grid = new Grid();
        grid.cells = cells.clone();
        grid.colsSet = colsSet.clone();
        grid.rowsSet = rowsSet.clone();
        grid.subgridSet = subgridSet.clone();
        return grid;
    }

    /**
     * Returns a string representing the current contents of the grid.
     * Used for debugging purposes.
     *
     * @return a non-null string representing the current contents of the grid.
     */
    public String toString() {
        StringBuffer buf = new StringBuffer();
        for (int r=0; r&lt;9; r++) {
            if (r%3 == 0) {
                buf.append("-------------------------\n");
            }
            for (int c=0; c&lt;9; c++) {
                if (c%3 == 0) {
                    buf.append("| ");
                }
                int num = cells[r*9+c];
                if (num == 0) {
                    buf.append(". ");
                } else {
                    buf.append(num+" ");
                }
            }
            buf.append("|\n");
        }
        buf.append("-------------------------");
        return buf.toString();
    }
}
</div></div>

Here's an example of an input file with three puzzles:


<div class="exd_code">
<div class="exd_code_head"><a href="">COPY</a></div>
<div class="exd_code_body"># This puzzle was obtained from sudoku.com
.6.|1.4|.5.
..8|3.5|6..
2..|...|..1
---+---+---
8..|4.7|..6
..6|...|3..
7..|9.1|..4
---+---+---
5..|...|..2
..7|2.6|9..
.4.|5.8|.7.
-----------

# <a href="http://www.sudoku.org.uk/bifurcation.htm" title="http://www.sudoku.org.uk/bifurcation.htm">http://www.sudoku.org.uk/bifurcation.htm</a>
1 0 0 9 0 7 0 0 3
0 8 0 0 0 0 0 7 0
0 0 9 0 0 0 6 0 0
0 0 7 2 0 9 4 0 0
4 1 0 0 0 0 0 9 5
0 0 8 5 0 4 3 0 0
0 0 3 0 0 0 7 0 0
0 5 0 0 0 0 0 4 0
2 0 0 8 0 6 0 0 9

# This puzzle has multiple solutions
1 2 3 4 5 6 7 8 9
0 6 0 0 0 0 0 3 0
0 7 0 0 0 0 0 4 0
7 8 9 1 2 3 4 5 6
0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0
4 5 6 7 8 9 1 2 3
0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0
</div></div>
Here's the output of the program when execute with the sample input file:


<div class="exd_code">
<div class="exd_code_head"><a href="">COPY</a></div>
<div class="exd_code_body">Original
-------------------------
| . 6 . | 1 . 4 | . 5 . |
| . . 8 | 3 . 5 | 6 . . |
| 2 . . | . . . | . . 1 |
-------------------------
| 8 . . | 4 . 7 | . . 6 |
| . . 6 | . . . | 3 . . |
| 7 . . | 9 . 1 | . . 4 |
-------------------------
| 5 . . | . . . | . . 2 |
| . . 7 | 2 . 6 | 9 . . |
| . 4 . | 5 . 8 | . 7 . |
-------------------------
Solved
-------------------------
| 9 6 3 | 1 7 4 | 2 5 8 |
| 1 7 8 | 3 2 5 | 6 4 9 |
| 2 5 4 | 6 8 9 | 7 3 1 |
-------------------------
| 8 2 1 | 4 3 7 | 5 9 6 |
| 4 9 6 | 8 5 2 | 3 1 7 |
| 7 3 5 | 9 6 1 | 8 2 4 |
-------------------------
| 5 8 9 | 7 1 3 | 4 6 2 |
| 3 1 7 | 2 4 6 | 9 8 5 |
| 6 4 2 | 5 9 8 | 1 7 3 |
-------------------------


Original
-------------------------
| 1 . . | 9 . 7 | . . 3 |
| . 8 . | . . . | . 7 . |
| . . 9 | . . . | 6 . . |
-------------------------
| . . 7 | 2 . 9 | 4 . . |
| 4 1 . | . . . | . 9 5 |
| . . 8 | 5 . 4 | 3 . . |
-------------------------
| . . 3 | . . . | 7 . . |
| . 5 . | . . . | . 4 . |
| 2 . . | 8 . 6 | . . 9 |
-------------------------
Solved
-------------------------
| 1 6 4 | 9 5 7 | 2 8 3 |
| 3 8 5 | 6 2 1 | 9 7 4 |
| 7 2 9 | 4 3 8 | 6 5 1 |
-------------------------
| 5 3 7 | 2 8 9 | 4 1 6 |
| 4 1 2 | 7 6 3 | 8 9 5 |
| 6 9 8 | 5 1 4 | 3 2 7 |
-------------------------
| 8 4 3 | 1 9 5 | 7 6 2 |
| 9 5 6 | 3 7 2 | 1 4 8 |
| 2 7 1 | 8 4 6 | 5 3 9 |
-------------------------


Original
-------------------------
| 1 2 3 | 4 5 6 | 7 8 9 |
| . 6 . | . . . | . 3 . |
| . 7 . | . . . | . 4 . |
-------------------------
| 7 8 9 | 1 2 3 | 4 5 6 |
| . . . | . . . | . . . |
| . . . | . . . | . . . |
-------------------------
| 4 5 6 | 7 8 9 | 1 2 3 |
| . . . | . . . | . . . |
| . . . | . . . | . . . |
-------------------------
At least two solutions
-------------------------
| 1 2 3 | 4 5 6 | 7 8 9 |
| 5 6 4 | 8 9 7 | 2 3 1 |
| 9 7 8 | 2 3 1 | 6 4 5 |
-------------------------
| 7 8 9 | 1 2 3 | 4 5 6 |
| 2 3 1 | 5 6 4 | 8 9 7 |
| 6 4 5 | 9 7 8 | 3 1 2 |
-------------------------
| 4 5 6 | 7 8 9 | 1 2 3 |
| 3 1 2 | 6 4 5 | 9 7 8 |
| 8 9 7 | 3 1 2 | 5 6 4 |
-------------------------
-------------------------
| 1 2 3 | 4 5 6 | 7 8 9 |
| 5 6 4 | 8 9 7 | 2 3 1 |
| 9 7 8 | 2 3 1 | 6 4 5 |
-------------------------
| 7 8 9 | 1 2 3 | 4 5 6 |
| 2 3 1 | 5 6 4 | 8 9 7 |
| 6 4 5 | 9 7 8 | 3 1 2 |
-------------------------
| 4 5 6 | 7 8 9 | 1 2 3 |
| 8 9 7 | 3 1 2 | 5 6 4 |
| 3 1 2 | 6 4 5 | 9 7 8 |
-------------------------


</div></div>
</div>
<!-- google_ad_section_end --></div>
</div>
<div class="cleared"></div>

</div>

    </div>
</div>
<div class="art-Block clear-block block block-views" id="block-views-comments-block_1">
    <div class="art-Block-cc"></div>
    <div class="art-Block-body">

	<div class="art-BlockHeader">
		    <div class="l"></div>
		    <div class="r"></div>
		    <div class="art-header-tag-icon">
		        <div class="t">	
			<h2 class="subject">Comments</h2>
</div>
		    </div>
		</div>    
	<div class="art-BlockContent content">
	    <div class="art-BlockContent-body">
	
		<div class="view view-comments view-id-comments view-display-id-block_1 view-dom-id-2">
    
  
  
      <div class="view-content">
        <div class="views-row views-row-1 views-row-odd views-row-first">
    <a id="comment-149"></a>
<div class="exd-comment">
  <table class="exd-comment-header" width="100%">
    <tbody>
	<tr>
	  <td>
	    26 Jan 2010 - 9:09am by Balazs (not verified)	  </td>
	  <td align="right">
	    	  </td>
	</tr>
	</tbody>
  </table>
  <div class="exd-comment-content">
	<p>Nice Job!</p>
  </div>
</div>
  </div>
  <div class="views-row views-row-2 views-row-even">
    <a id="comment-152"></a>
<div class="exd-comment">
  <table class="exd-comment-header" width="100%">
    <tbody>
	<tr>
	  <td>
	    27 Jan 2010 - 12:10am by Abi (not verified)	  </td>
	  <td align="right">
	    	  </td>
	</tr>
	</tbody>
  </table>
  <div class="exd-comment-content">
	<p>you are a great man</p>
  </div>
</div>
  </div>
  <div class="views-row views-row-3 views-row-odd">
    <a id="comment-158"></a>
<div class="exd-comment">
  <table class="exd-comment-header" width="100%">
    <tbody>
	<tr>
	  <td>
	    28 Jan 2010 - 1:44am by Anonymous (not verified)	  </td>
	  <td align="right">
	    	  </td>
	</tr>
	</tbody>
  </table>
  <div class="exd-comment-content">
	<p>Funny and handy !</p>
  </div>
</div>
  </div>
  <div class="views-row views-row-4 views-row-even">
    <a id="comment-161"></a>
<div class="exd-comment">
  <table class="exd-comment-header" width="100%">
    <tbody>
	<tr>
	  <td>
	    28 Jan 2010 - 5:55am by Anonymous (not verified)	  </td>
	  <td align="right">
	    	  </td>
	</tr>
	</tbody>
  </table>
  <div class="exd-comment-content">
	<p>good work</p>
  </div>
</div>
  </div>
  <div class="views-row views-row-5 views-row-odd">
    <a id="comment-163"></a>
<div class="exd-comment">
  <table class="exd-comment-header" width="100%">
    <tbody>
	<tr>
	  <td>
	    28 Jan 2010 - 9:13am by Bogdan (not verified)	  </td>
	  <td align="right">
	    	  </td>
	</tr>
	</tbody>
  </table>
  <div class="exd-comment-content">
	<p>very nice</p>
  </div>
</div>
  </div>
  <div class="views-row views-row-6 views-row-even">
    <a id="comment-187"></a>
<div class="exd-comment">
  <table class="exd-comment-header" width="100%">
    <tbody>
	<tr>
	  <td>
	    2 Feb 2010 - 3:59am by Anonymous (not verified)	  </td>
	  <td align="right">
	    	  </td>
	</tr>
	</tbody>
  </table>
  <div class="exd-comment-content">
	<p>I want a program says if an array is aleady sorted</p>
<p>please help</p>
  </div>
</div>
  </div>
  <div class="views-row views-row-7 views-row-odd">
    <a id="comment-400"></a>
<div class="exd-comment">
  <table class="exd-comment-header" width="100%">
    <tbody>
	<tr>
	  <td>
	    9 Mar 2010 - 11:12pm by Anonymous (not verified)	  </td>
	  <td align="right">
	    	  </td>
	</tr>
	</tbody>
  </table>
  <div class="exd-comment-content">
	<p>Thanks</p>
  </div>
</div>
  </div>
  <div class="views-row views-row-8 views-row-even">
    <a id="comment-449"></a>
<div class="exd-comment">
  <table class="exd-comment-header" width="100%">
    <tbody>
	<tr>
	  <td>
	    17 Mar 2010 - 11:25pm by Anonymous (not verified)	  </td>
	  <td align="right">
	    	  </td>
	</tr>
	</tbody>
  </table>
  <div class="exd-comment-content">
	<p>Thats nice</p>
  </div>
</div>
  </div>
  <div class="views-row views-row-9 views-row-odd">
    <a id="comment-1105"></a>
<div class="exd-comment">
  <table class="exd-comment-header" width="100%">
    <tbody>
	<tr>
	  <td>
	    5 Apr 2010 - 4:48am by Anonymous (not verified)	  </td>
	  <td align="right">
	    	  </td>
	</tr>
	</tbody>
  </table>
  <div class="exd-comment-content">
	<p>That's a great code.. By the way is it optimal??</p>
  </div>
</div>
  </div>
  <div class="views-row views-row-10 views-row-even">
    <a id="comment-1358"></a>
<div class="exd-comment">
  <table class="exd-comment-header" width="100%">
    <tbody>
	<tr>
	  <td>
	    14 Apr 2010 - 5:46pm by Lolandrea (not verified)	  </td>
	  <td align="right">
	    	  </td>
	</tr>
	</tbody>
  </table>
  <div class="exd-comment-content">
	<p>I have one which uses "Las Vegas" algorithm... Is faster and is shorter.... :P</p>
  </div>
</div>
  </div>
  <div class="views-row views-row-11 views-row-odd">
    <a id="comment-1378"></a>
<div class="exd-comment">
  <table class="exd-comment-header" width="100%">
    <tbody>
	<tr>
	  <td>
	    19 Apr 2010 - 11:21pm by waism (not verified)	  </td>
	  <td align="right">
	    	  </td>
	</tr>
	</tbody>
  </table>
  <div class="exd-comment-content">
	<p>please tell the basic of making the frames and buttons in java</p>
  </div>
</div>
  </div>
  <div class="views-row views-row-12 views-row-even">
    <a id="comment-1379"></a>
<div class="exd-comment">
  <table class="exd-comment-header" width="100%">
    <tbody>
	<tr>
	  <td>
	    19 Apr 2010 - 11:21pm by waism (not verified)	  </td>
	  <td align="right">
	    	  </td>
	</tr>
	</tbody>
  </table>
  <div class="exd-comment-content">
	<p>please tell the basic of making the frames and buttons in java</p>
  </div>
</div>
  </div>
  <div class="views-row views-row-13 views-row-odd">
    <a id="comment-1404"></a>
<div class="exd-comment">
  <table class="exd-comment-header" width="100%">
    <tbody>
	<tr>
	  <td>
	    26 Apr 2010 - 2:57pm by can any 1 pls explain this for me pleas i am trying to learn (not verified)	  </td>
	  <td align="right">
	    	  </td>
	</tr>
	</tbody>
  </table>
  <div class="exd-comment-content">
	<p>i got this code form java2s web site saying that /Passing Objects to a Method<br>
does it means that it has passed instant of the class as you can see class (Sphere)</p>
<p>class Sphere {<br>
  double radius; // Radius of a sphere</p>
<p>  Sphere() {</p>
<p>  }</p>
<p>  // Class constructor<br>
  Sphere(double theRadius) {<br>
    radius = theRadius; // Set the radius</p>
<p>  }</p>
<p>}</p>
<p>public class MainClass {<br>
  public static void main(String[] arg){<br>
    Sphere sp = new Sphere();</p>
<p>    aMethod(sp);<br>
  }</p>
<p>  private static void aMethod(Sphere sp){<br>
    System.out.println(sp);<br>
  }<br>
}</p>
  </div>
</div>
  </div>
  <div class="views-row views-row-14 views-row-even">
    <a id="comment-2610"></a>
<div class="exd-comment">
  <table class="exd-comment-header" width="100%">
    <tbody>
	<tr>
	  <td>
	    23 Jun 2010 - 6:15am by Bruno (not verified)	  </td>
	  <td align="right">
	    	  </td>
	</tr>
	</tbody>
  </table>
  <div class="exd-comment-content">
	<p>Oi vc poderia me ajudar me ajude o programa é mais ou menos assim 2 
form 1 com cadastro de produto que tera 3 label codigo , descriçao, 
preço, 3 caixa de text para os tres labels, um button gravar(aqui grava a
 tabela produto) e um button sair. No outro form cadastro de venda tera 
codigo da venda 1, 2 ou 3, a data, preço,quantidade e o total (ou seja 
multiplicando o preço pela quantidade de produtos aparecendo o valor na 
caixa de text total!!!) a mesma coisa do outro colocando os numeros nas 
ciaxas de text e a descriçaõ do produto entende? os produtos podem ser 
laranja, maça e melancia!! entao essas duas classes no caso né cadastro 
de produtoe cadastro de venda vai chamar essas duas tabelas no MYSQL 
T1:codigo, descrição, preço e T2: codigo venda , data da venda total 
entende? porque ai tem lá as tabelas no mysql para conecta com o java 
entende? me ajuda ai precisava para amanha!!!!! é porque só encontrei o 
site hoje!!!!</p>
  </div>
</div>
  </div>
  <div class="views-row views-row-15 views-row-odd">
    <a id="comment-2611"></a>
<div class="exd-comment">
  <table class="exd-comment-header" width="100%">
    <tbody>
	<tr>
	  <td>
	    23 Jun 2010 - 6:44am by Bruno (not verified)	  </td>
	  <td align="right">
	    	  </td>
	</tr>
	</tbody>
  </table>
  <div class="exd-comment-content">
	<p>O PROGRAMA NÃO É NetBeans !</p>
  </div>
</div>
  </div>
  <div class="views-row views-row-16 views-row-even views-row-last">
    <a id="comment-2612"></a>
<div class="exd-comment">
  <table class="exd-comment-header" width="100%">
    <tbody>
	<tr>
	  <td>
	    23 Jun 2010 - 6:45am by Bruno (not verified)	  </td>
	  <td align="right">
	    	  </td>
	</tr>
	</tbody>
  </table>
  <div class="exd-comment-content">
	<p>O PROGRAMA É NetBeans</p>
  </div>
</div>
  </div>
    </div>
  
  
  
  
  
  
</div> 
	    </div>
	</div>
	

    </div>
</div>
<div class="art-Block clear-block block block-commentblock" id="block-commentblock-comment_form">
    <div class="art-Block-cc"></div>
    <div class="art-Block-body">

	<div class="art-BlockHeader">
		    <div class="l"></div>
		    <div class="r"></div>
		    <div class="art-header-tag-icon">
		        <div class="t">	
			<h2 class="subject">Post a comment</h2>
</div>
		    </div>
		</div>    
	<div class="art-BlockContent content">
	    <div class="art-BlockContent-body">
	
		<form action="/comment/reply/2278" accept-charset="UTF-8" method="post" id="comment-form">
<div><div class="form-item" id="edit-name-wrapper">
 <label for="edit-name">Your name: </label>
 <input maxlength="60" name="name" id="edit-name" size="30" value="Anonymous" class="form-text" type="text">
</div>
<div class="form-item" id="edit-comment-wrapper">
 <label for="edit-comment">Comment: <span class="form-required" title="This field is required.">*</span></label>
 <div class="resizable-textarea"><span><textarea cols="60" rows="3" name="comment" id="edit-comment" class="form-textarea resizable required textarea-processed"></textarea><div style="margin-right: -4px;" class="grippie"></div></span></div>
</div>
<p><a href="http://www.exampledepot.com/filter/tips">More information about formatting options</a></p><input name="form_build_id" id="form-c3e3738e8a8b44c215a6a68df78451a8" value="form-c3e3738e8a8b44c215a6a68df78451a8" type="hidden">
<input name="form_id" id="edit-comment-form" value="comment_form" type="hidden">
<fieldset class="captcha"><legend>CAPTCHA</legend><div class="description">This question is for testing whether you are a human visitor and to prevent automated spam submissions.</div><input name="captcha_sid" id="edit-captcha-sid" value="4871039" type="hidden">
<img src="sudoku_solver_SudokuSolver_dosyalar/1280236957.png" alt="Image CAPTCHA" title="Image CAPTCHA"><div class="form-item" id="edit-captcha-response-wrapper">
 <label for="edit-captcha-response">What code is in the image?: <span class="form-required" title="This field is required.">*</span></label>
 <input maxlength="128" name="captcha_response" id="edit-captcha-response" size="15" class="form-text required" type="text">
 <div class="description">Enter the characters shown in the image. Ignore spaces and be careful about upper and lower case.</div>
</div>
</fieldset>
<span class="art-button-wrapper"><span class="l"></span><span class="r"></span><input name="op" id="edit-submit-1" value="Post" class="form-submit art-button" type="submit"></span>
</div></form>

	    </div>
	</div>
	

    </div>
</div>
</div>

</div>
<div class="cleared"></div>
<div class="art-Footer">
    <div class="art-Footer-inner">
        <a href="http://www.exampledepot.com/rss.xml" class="art-rss-tag-icon"></a>        <div class="art-Footer-text">
        <p><a href="http://www.exampledepot.com/user">Login</a>&nbsp;|&nbsp;<a href="#">Terms of Use</a>&nbsp;|&nbsp;<a href="#">Trademarks</a>&nbsp;|&nbsp;<a href="#">Privacy Statement</a><br>Copyright © 2009&nbsp;Example Depot.&nbsp;All Rights Reserved.</p>                </div>        
    </div>
    <div class="art-Footer-background"></div>
</div>

    </div>
</div>
<div class="cleared"></div>

</div>



<div style="position: absolute; left: 415px; top: 410px; width: 22px; height: 10px; z-index: 99;"><embed id="ZeroClipboardMovie_1" src="sudoku_solver_SudokuSolver_dosyalar/ZeroClipboard.swf" loop="false" menu="false" quality="best" bgcolor="#ffffff" name="ZeroClipboardMovie_1" allowscriptaccess="always" allowfullscreen="false" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" flashvars="id=1&amp;width=22&amp;height=10" wmode="transparent" align="middle" width="22" height="10"></div><div style="position: absolute; left: 415px; top: 606px; width: 22px; height: 10px; z-index: 99;"><embed id="ZeroClipboardMovie_2" src="sudoku_solver_SudokuSolver_dosyalar/ZeroClipboard.swf" loop="false" menu="false" quality="best" bgcolor="#ffffff" name="ZeroClipboardMovie_2" allowscriptaccess="always" allowfullscreen="false" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" flashvars="id=2&amp;width=22&amp;height=10" wmode="transparent" align="middle" width="22" height="10"></div><div style="position: absolute; left: 415px; top: 2150px; width: 22px; height: 10px; z-index: 99;"><embed id="ZeroClipboardMovie_3" src="sudoku_solver_SudokuSolver_dosyalar/ZeroClipboard.swf" loop="false" menu="false" quality="best" bgcolor="#ffffff" name="ZeroClipboardMovie_3" allowscriptaccess="always" allowfullscreen="false" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" flashvars="id=3&amp;width=22&amp;height=10" wmode="transparent" align="middle" width="22" height="10"></div><div style="position: absolute; left: 415px; top: 5810px; width: 22px; height: 10px; z-index: 99;"><embed id="ZeroClipboardMovie_4" src="sudoku_solver_SudokuSolver_dosyalar/ZeroClipboard.swf" loop="false" menu="false" quality="best" bgcolor="#ffffff" name="ZeroClipboardMovie_4" allowscriptaccess="always" allowfullscreen="false" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" flashvars="id=4&amp;width=22&amp;height=10" wmode="transparent" align="middle" width="22" height="10"></div><div style="position: absolute; left: 415px; top: 6496px; width: 22px; height: 10px; z-index: 99;"><embed id="ZeroClipboardMovie_5" src="sudoku_solver_SudokuSolver_dosyalar/ZeroClipboard.swf" loop="false" menu="false" quality="best" bgcolor="#ffffff" name="ZeroClipboardMovie_5" allowscriptaccess="always" allowfullscreen="false" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" flashvars="id=5&amp;width=22&amp;height=10" wmode="transparent" align="middle" width="22" height="10"></div></body></html>